<?php

class BlindList extends Node
{

    //set in the constructor
    protected $numItems;
    protected $authorityName;
    protected $orderField;
    //setted by magic methods
    protected $oppened = false;
    //used internaly
    private $initItem = 0;
    static $numBlindList = 0;

    function setOppened( $open )
    {
        $this->oppened = $open;
    }

    function setInitItem( $num )
    {
        $this->initItem = $num;
    }

    function handleGET( Event $e )
    {
        switch ( $e->tag ) {
            case 'open':
                $this->setOppened( true );
                $e->cancelBubble();
                break;
            case 'close':
                $this->setOppened( false );
                $e->cancelBubble();
                break;
        }
    }

    function fill()
    {
        if ( $this->oppened ) {

            $eltos = array( );

            Node::getArray( $this->authorityName, $datos, '', $this->orderField,
                    $this->initItem, $this->numItems );
            foreach ( $eltos as $e ) $this->appendChild( $e );


            self::$numBlindList++;
            if ( count( $eltos ) == $this->numItems ) {

                $blind = Node::getInstance( Deployment::$POLICIES_NAMES[ $this->authorityName ],
                                self::$numBlindList );
                $blind->setInitItem( $this->numItems + $this->initItem );
                $this->appendChild( $blind );
            }
        }
        //al final si hay he desarrollado todos los items tengo que crear otro objeto persiana
    }

}

?>
